<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components"
       xmlns:ice="http://www.icesoft.com/icefaces/component"
       xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title><h:form><h:outputText>Neues Übungsblatt anlegen</h:outputText></h:form></title>
        <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
    </h:head>
    <h:body styleClass="ice-skin-sam">
        <ui:composition template="WEB-INF/templates/lecture.xhtml">
            <ui:define name="content">
                    <ice:outputText value="Neues Übungsblatt anlegen"/>
                    <br />
                    <br />
                    <h:form>
                        <ice:outputText value="Name des Übungsblattes" />
                        <ice:inputText value="#{newSheetBean.sheet.name}"
                                       partialSubmit="true"/>
                    </h:form>
                    <br />
                    <h:form>
                        <ice:selectOneMenu value="#{newSheetBean.sheet.category}"
                                           partialSubmit="true">
                            <f:converter converterId="taskCategoryConverter" />
                            <f:selectItems value="#{newSheetBean.categoryItems}" />
                        </ice:selectOneMenu>
                        <ice:outputText value="#{netSheetBean.sheet.category.name}" />
                    </h:form>    
                    
                    <br />
                    
                     <ice:outputText value="Übungsblatt auswählen " />                      
                     <ice:outputText value="Hochgeladen"
                                     rendered="#{newSheetBean.isExerciseUploaded}" />
                     <br />
                     <br />
                                          
                     <h:form>
                            <ace:fileEntry fileEntryListener="#{newSheetBean.exerciseUploadListener}"                                         
                                           id="ueblattupload"
                                           useOriginalFilename="true"
                                           useSessionSubdir="true"/>
                            <h:commandButton value="Hochladen" />
                     </h:form>
                     
                     <br />
                     <br />
                     <ice:outputText value="Musterlösung auswählen " />                      
                     <ice:outputText value="Hochgeladen"
                                     rendered="#{newSheetBean.isSolutionUploaded}" />
                     <h:form>
                         <ace:fileEntry fileEntryListener="#{newSheetBean.solutionUploadListener}"
                                        useOriginalFilename="true"
                                        useSessionSubdir="true" />
                         <h:commandButton value="Hochladen" />
                     </h:form>
                     <ice:outputText value="Ausgabetermin" />
                     <h:form>
                        <ace:dateTimeEntry  renderAsPopup="true"
                                          renderInputField="true"
                                          value="#{newSheetBean.sheet.dateOfRelease}">
                            <f:convertDateTime pattern="dd/MM/yyyy hh:mm a" timeZone="UTC"/>
                        </ace:dateTimeEntry>                                          
                      </h:form>   
                                          
                      <br />
                      <ice:outputText value="Abgabetermin" />
                      <h:form>
                          <ace:dateTimeEntry renderAsPopup="true"
                                             renderInputField="true"                                         
                                             value="#{newSheetBean.sheet.dateOfReturn}">
                            <f:convertDateTime pattern="dd/MM/yyyy hh:mm" timeZone="UTC"/>
                        </ace:dateTimeEntry>
                      </h:form>    
                       
                      <br />
                      <ice:outputText value="Bearbeitungszeitraum" />
                      <h:form>
                        <ice:inputText value="#{newSheetBean.sheet.correctionTime}" />
                      </h:form>
                      <ice:outputText value="(0 = unendlich)" />
                      <br />
                    <h:form>
                        <ice:outputText value="Anzahl an Aufgaben" />
                        <br />
                        <ice:inputText partialSubmit="true"
                                       valueChangeListener="#{newSheetBean.valueChangeNumberSheets}"
                                       value="#{newSheetBean.numExercises}"/>
                    </h:form>
                          <br />
                          <h:form>
                          <ice:dataTable var="row"
                                         value="#{newSheetBean.sheet.exercises}"
                                         rendered="#{newSheetBean.numExercises != 0}">
                                <ice:column>
                                    <f:facet name="header">
                                        <ice:outputText value="Name" />
                                    </f:facet>
                                    <ice:inputText value="#{row.name}" />
                                </ice:column>
                              <ice:column>
                                  <f:facet name="header">
                                      <ice:outputText value="Max. Punkte" />
                                  </f:facet>
                                  <ice:inputText value="#{row.maxScore}" />
                              </ice:column>
                              <ice:column>
                                  <f:facet name="header">
                                      <ice:outputText value="option?" />
                                  </f:facet>
                                  <ice:selectBooleanCheckbox value="#{row.optional}" />
                              </ice:column>
                          </ice:dataTable>
                          </h:form>      
                    <br />

                    <ice:outputText value="Anzahl an elektronischen Abgaben" />
                    <h:form>
                        <ice:inputText partialSubmit="true"
                                       valueChangeListener="#{newSheetBean.valueChangeNumberHandingIns}"
                                       value="#{newSheetBean.numHandingIns}"/>
                    </h:form>

                    <br />
                    <h:form>
                        <ice:dataTable var="row"
                                         value="#{newSheetBean.sheet.handingIns}"
                                         rendered="#{newSheetBean.numHandingIns != 0}">
                              <ice:column>
                                  <f:facet name="header">
                                      <ice:outputText value="Bezeichnung" />
                                  </f:facet>
                                  <ice:inputText value="#{row.name}" 
                                                 partialSubmit="true"/>
                              </ice:column>

                              <ice:column>
                                  <f:facet name="header">
                                      <ice:outputText value="Präfix" />
                                  </f:facet>
                                  <ice:inputText value="#{row.preFixFile}" 
                                                 partialSubmit="true"/>
                              </ice:column>

                              <ice:column>
                                  <f:facet name="header">
                                      <ice:outputText value="Abgabedatum" />
                                  </f:facet>
                                  <h:form>
                                      <ace:dateTimeEntry renderAsPopup="true"
                                                         value="#{row.handingInDate}" 
                                                         renderInputField="true"
                                                         singleSubmit="true">
                                        <f:convertDateTime pattern="dd/MM/yyyy hh:mm a" timeZone="UTC"/>
                                      </ace:dateTimeEntry>
                                  </h:form>  
                              </ice:column>
                          </ice:dataTable>
                        </h:form>      

                    <h:form>
                        <ice:commandButton action="#{newSheetBean.addSheet()}" 
                                           value="Absenden"/>
                    </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
    <h:outputStylesheet library="org.icefaces.component.skins" name="sam.css" />
</html>
